<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>订单管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../script/jquery-1.4.4.min.js"></script>
<script language="javascript" src="../script/Calendar.js"></script>
</head>
<body>
<div class="container">
    <div class="flow">
        <div class="itemtitle">
            <h3>售后管理</h3>
            <ul>
                <li <{if $smarty.get.status==''}>class="current"<{/if}>><a href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>"><span>管理</span></a></li>
                <{foreach item=list key=num from=$after_sale_status}>
                <li <{if $smarty.get.status==$num}>class="current"<{/if}>><a href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&status=<{$num}>"><span><{$list}></span></a></li>
                <{/foreach}>
            </ul>
        </div>
    </div>
    <div class="h35"></div>
    <table class="select_table">
        <tr>    
            <td>
                <div class="select_box">
                <form action="" method="get">
                    <input type="hidden" name="m" value="<{$smarty.get.m}>">
                    <input type="hidden" name="s" value="after_sale.php">
                    <input type="hidden" name="status" value="<{$smarty.get.status}>">
                    <input placeholder="请输入订单编号..." type="text" name="code" class="txt w250" value="<{$smarty.get.code}>" />
                    <input type="submit" value="搜索" />
                </form>
                </div>
                <div class="search">
                    <a class="a-search" href="#">高级搜索</a>
                    <div class="div-search">
                        <div class="close"></div>
                        <div class="line"></div>
                        <div class="search-con clearfix">
                        <form action="" method="get">
                        <input type="hidden" name="m" value="<{$smarty.get.m}>">
                        <input type="hidden" name="s" value="after_sale.php">
                        <input type="hidden" name="status" value="<{$smarty.get.status}>">
                        <dl>
                            <dt>订单编号</dt>
                            <dd><input type="text" class="w250" name="code" value="<{$smarty.get.code}>" /></dd>
                        </dl>
                        <dl>
                            <dt>商品SKU_ID</dt>
                            <dd><input type="text" class="w250" name="product_id" value="<{$smarty.get.product_id}>" /></dd>
                        </dl>
                        <dl>
                            <dt>商品名称</dt>
                            <dd><input type="text" class="w250" name="product_name" value="<{$smarty.get.product_name}>" /></dd>
                        </dl>
                        <dl>
                            <dt>状态</dt>
                            <dd>
                            <select name="after_sale_status" class="w250">
                            <option value="">请选择</option>
                            <{foreach item=list key=key from=$after_sale_status}>
                            <option <{if $smarty.get.after_sale_status==$key}>selected="selected"<{/if}> value="<{$key}>"><{$list}></option>
                            <{/foreach}>
                            </select>
                            </dd>
                        </dl>
                        <dl>
                            <dt>申请时间</dt>
                            <dd>
                            <script language="javascript">
            var cdr = new Calendar("cdr");
            document.write(cdr);
            cdr.showMoreDay = true;
        </script>
                            <input onFocus="cdr.show(this);" class="w118" type="text" name="stime" id="stime" value="<{$smarty.get.stime}>"">
                            -
                            <input onFocus="cdr.show(this);" class="w118" type="text" name="etime" id="etime" value="<{$smarty.get.etime|default:$smarty.now+86399|date_format:'%Y-%m-%d'}>"">
                            </dd>
                        </dl>
                        <dl>
                            <dt>会员名</dt>
                            <dd><input type="text" class="w250" name="user" value="<{$smarty.get.user}>" /></dd>
                        </dl>
                        <dl>
                            <dt>联系人</dt>
                            <dd><input type="text" class="w250" name="contact_person" value="<{$smarty.get.contact_person}>" /></dd>
                        </dl>
                        <dl>
                            <dt>联系电话</dt>
                            <dd><input type="text" class="w250" name="contact_mobile" value="<{$smarty.get.contact_mobile}>" /></dd>
                        </dl>
                        <input type="submit" value="搜索" />
                        </form>
                        </div>
                    </div>
                </div>
                <a class="refresh" href="?m=<{$smarty.get.m}>&s=<{$smarty.get.s}>&status=<{$smarty.get.status}>"></a>
           </td>
        </tr>
    </table>
    <table class="table product">
       <tbody>
       <tr class="header">
            <th width="40">查看</th>
            <th width="60">操作</th>
            <th class="al">订单编号</th>
            <th width="150">用户名</th>
            <th width="150">商品名称</th>
            <th width="150">商品数量</th>
            <th width="150">申请理由</th>
            <th width="150">联系人</th>
            <th width="150">联系电话</th>
            <th width="100">申请时间</th>
            <th width="130">状态</th>
        </tr>
        <{foreach item=list from=$de.list}>
        <tr class="<{if $list.status==1}>bold<{/if}>">
            <td><a href="?m=product&s=after_sale_detail.php&id=<{$list.id}>">查看</a></td>
            <td>
            <{if $list.status!=-1 and $list.status!=9}>
            <div class="operate">
                <a class="opear" href="#">操作<i></i></a>
                <ul>
<{if $list.status==1}>
<li><a class="a-opear" data-type="pass" data-param="{'id':'<{$list.id}>'}" href="#">审核通过</a></li>
<li><a class="a-opear" data-type="not_pass" data-param="{'id':'<{$list.id}>'}" href="#">不通过</a></li>
<{/if}>
<{if $list.status==3}>
<li><a class="a-opear" data-type="recieved" data-param="{'id':'<{$list.id}>'}" href="#">已收货</a></li>
<{/if}>
<{if $list.status==4}>
<li><a class="a-opear" data-type="check_yes" data-param="{'id':'<{$list.id}>'}" href="#">验收通过</a></li>
<li><a class="a-opear" data-type="check_no" data-param="{'id':'<{$list.id}>'}" href="#">验收失败</a></li>
<{/if}>
<{if $list.status==5}>
<li><a class="a-opear" data-type="complete" data-param="{'id':'<{$list.id}>'}" href="#">完成</a></li>
<{/if}>
<li><a class="a-opear" data-type="cancel" data-param="{'id':'<{$list.id}>'}" href="#">取消</a></li>
                </ul>
            </div>
            <{elseif $list.status==9}>
            已完成
            <{else}>
            已取消
            <{/if}>
            </td>
            <td class="al"><{$list.order_id}></td>
            <td><{$list.user_nick_name}></td>
            <td><{$list.product_name}></td>
            <td><{$list.num}></td>
            <td><{$list.description}></td>
            <td><{$list.contact_person}></td>
            <td><{$list.contact_mobile}></td>
            <td><{$list.create_time}></td>
            <td><{$list.status_name}></td>
        </tr>
        <{foreachelse}>
        <tr>
            <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
        </tr>
        <{/foreach}>
        </tbody>
        <tfoot>
            <tr>
                <td colspan="99">
                    <div class="fl">每页最多显示： 20条</div>
                    <div class="page"><{$de.page}></div>
                    <div class="fr">共有<{$de.count}>条记录</div>
                </td>
            </tr>
        </tfoot>
    </table>
<script>
$(".a-opear").live('click',function(){
    
    var data = $(this).attr('data-param');
    eval("data = "+data);
    var type = $(this).attr('data-type');
    if(!data.id)
    {
        error('error','对不起，请选择订单后操作！');
        return false;
    }
    
    window.parent.ajax_form("after_sale", "操作售后申请", '<{$config.weburl}>/admin/module.php?m=product&s=after_sale.php&type='+type+'&id='+data.id, 800);
    return false;
    
});
$('.operate').hover(function(){                  
    if ($(this).position().top + $(this).children("ul").height() + $(this).parent("td").height() - $(window).height()- $(window).scrollTop()  < 0) {
        $(this).addClass("hover");
        $(this).children("ul").css("top", "22px");
    } else {
        $(this).addClass("hover-up");
        $(this).children("ul").css("top", -$(this).children("ul").height());
    }
},function(){
    $(this).removeClass("hover").removeClass("hover-up");   
});
$('.search').bind("mouseenter", function (e) {
    $(this).addClass("hover");
}).bind("mouseleave", function (e) {
    //$(this).removeClass("hover");
});
$('.close').bind("click", function (e) {
    $(this).parent().parent().removeClass("hover");
}) 
$('#stime').click(function () {
    var left = $("#Calendar").css("left");
    left = left.substring(0,left.length-2);
    left = left - 359;
    left = left+"px";
    var top = $("#Calendar").css("top");
    top = top.substring(0,top.length-2);
    top = top - 90;
    top = top+"px";
    $("#Calendar").css("left",left);
    $("#Calendar").css("top",top);
}) 
$('#etime').click(function () {
    var left = $("#Calendar").css("left");
    left = left.substring(0,left.length-2);
    left = left - 359;
    left = left+"px";
    var top = $("#Calendar").css("top");
    top = top.substring(0,top.length-2);
    top = top - 90;
    top = top+"px";
    $("#Calendar").css("left",left);
    $("#Calendar").css("top",top);
}) 
</script>    
</div>
</body>
</html>